var arr = [3, 5, 7, 1, 4, 56, 12, 37, 78, 25, 0, 9, 3, 8, 42];

function quickSort(array, start, end) {
    console.log()
    if (end - start < 2) return;
    const target = array[start];
    let l = start;
    let r = end;
    while (l < r) {
        while (target <= arr[r] && l < r) {
            r--;
        }
        arr[l] = arr[r];
        while (arr[l] < target && l < r) {
            l++;
        }
        arr[r] = arr[l];
        arr[l] = target;
    }
    quickSort(array, start, l - 1);
    quickSort(array, l + 1, end);
    return array;
}

console.log(quickSort(arr, 0, arr.length - 1));